#include "ContextAgentBehaviour.h"

ContextAgentBehaviour::ContextAgentBehaviour()
{
	inited=false;
}

ContextAgentBehaviour::~ContextAgentBehaviour()
{
}
void ContextAgentBehaviour::select(AttributeHolder *attributes,std::string key) {

	if (!inited) {
		inited=true;
		init(attributes);
	}
	ActionSelector *s = CURRENT_SELECTOR.get(attributes);
	if (s==0) {
		printf("no action registered\n");
	}
	else
		selectedAction = s->select(attributes,key);
}


ValueHandler<ActionSelector> ContextAgentBehaviour::CURRENT_SELECTOR= ValueHandler<ActionSelector>(AttributeHolder::SESSION);
ValueHandler<ActionSelector> ContextAgentBehaviour::ROOT_SELECTOR= ValueHandler<ActionSelector>(AttributeHolder::SESSION);
